﻿Imports System.Web.UI.WebControls
Imports System.Web

Namespace DotNetNuke.Modules.ActiveForums
    Partial Public Class af_search_new
        Inherits ForumBase
#Region "Private Members"
        Private RowCount As Integer = 0
        Private dtResults As DataTable
        Private PageSize As Integer = 20
        Private RowIndex As Integer = 0
#End Region
#Region "Event Handlers"
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Try

                txtSearch.Attributes.Add("onkeydown", "if(event.keyCode == 13){document.getElementById('" & lnkSearch.ClientID & "').click();}")
                BindSearchRange()


                If Not Page.IsPostBack Then
                    BindForumsTree()
                    CheckNodes()

                    litSearchColumns.Text = GetSharedResource("[RESX:SearchArea]")
                    litSearchType.Text = GetSharedResource("[RESX:SearchMatch]")
                    litSearchTimeFrame.Text = GetSharedResource("[RESX:SearchTimeFrame]")
                    litSearchUserText.Text = GetSharedResource("[RESX:SearchByUser]")
                    litSearchForums.Text = GetSharedResource("[RESX:SearchInForums]")


                    lnkSearch.Text = "<img src=""" & ImagePath & "/images/search.png"" style=""vertical-align:middle;border:none;"" alt=""" & GetSharedResource("[RESX:Search]") & """ />" & GetSharedResource("[RESX:Search]")
                    Dim SortDirection As String
                    If Not Request.Params("afsort") Is Nothing Then
                        SortDirection = Request.Params("afsort")
                    Else
                        SortDirection = "DESC"
                    End If
                    'Setup Tree
                    Dim sq As String = String.Empty
                    If Not String.IsNullOrEmpty(Request.QueryString("q")) Then
                        sq = Server.UrlDecode(Request.QueryString("q"))
                        sq = Utilities.XSSFilter(sq)
                    End If
                    Environment.UpdateMeta(Me.BasePage, "[VALUE] - " & GetSharedResource("[RESX:Search]") & " - " & sq, "[VALUE]", "[VALUE]")
                    BindPosts(0, SortDirection)
                End If
            Catch ex As Exception
                Me.Controls.Clear()
                RenderMessage("[RESX:ERROR]", "[RESX:ERROR:Search]", ex.Message, ex)
            End Try


        End Sub
        Private Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkSearch.Click
            If Not txtSearch.Text.Trim = String.Empty Then
                Dim s As String = txtSearch.Text.Trim
                s = Utilities.XSSFilter(s)
                s = Server.UrlEncode(s)
                Dim mt As Integer = 0
                mt = CInt(drpSearchType.SelectedItem.Value)
                Dim sf As Integer = 0
                sf = CInt(drpSearchColumns.SelectedItem.Value)
                Dim ts As Integer = 0
                ts = CInt(drpSearchDays.SelectedItem.Value)
                Dim au As Integer = 0
                If Not Request.Params("uid") Is Nothing Then
                    If IsNumeric(Request.Params("uid")) Then
                        au = CInt(Request.Params("uid"))
                    End If
                End If
                Dim an As String = "0"
                If Not txtUserName.Text.Trim = "" Then
                    an = txtUserName.Text
                    an = Utilities.CheckSqlString(an)
                    an = Utilities.XSSFilter(an)
                    an = HttpUtility.UrlEncode(an)
                End If
                Dim f As String = "0"
                If Not GetNodeCount() = trForums.CheckedNodes.Count Then
                    If trForums.CheckedNodes.Count > 1 Then
                        f = ""
                        For Each tr As TreeNode In trForums.CheckedNodes
                            If tr.Value.Contains("F:") Then
                                f &= tr.Value.Split(CChar(":"))(1) & ":"
                            End If
                        Next
                    Else
                        Dim sv As String = trForums.CheckedNodes.Item(0).Value
                        If sv.Contains("F:") Then
                            f = sv.Split(CChar(":"))(1)
                        End If
                    End If
                End If
                Response.Redirect(NavigateUrl(TabId, "", New String() {ParamKeys.ViewType & "=search", "q=" & s, "k=" & mt.ToString, "c=" & sf.ToString, "ts=" & ts.ToString, "uid=" & au.ToString, "author=" & an, "f=" & f}))
            End If

        End Sub
#End Region

#Region "Private Methods"
        Private Sub BindPosts(Optional ByVal Column As Integer = 0, Optional ByVal Sort As String = "ASC")
            PageSize = MainSettings.PageSize
            If UserId > 0 Then
                PageSize = UserDefaultPageSize
            End If
            If PageSize < 5 Then
                PageSize = 10
            End If
            If PageId = 1 Then
                RowIndex = 0
            Else
                RowIndex = ((PageId * PageSize) - PageSize)
            End If
            lblHeader.Text = GetSharedResource("[RESX:Search]")
            Dim MatchType As Integer = 0
            Dim SearchString As String = ""
            If Not Request.Params("q") Is Nothing Then
                SearchString = Request.Params("q")
                SearchString = Server.UrlDecode(SearchString)
                SearchString = Utilities.XSSFilter(SearchString)
                SearchString = Utilities.StripHTMLTag(SearchString)
                SearchString = Utilities.CheckSqlString(SearchString)
                SearchString = SearchString.Trim
                txtSearch.Text = SearchString
            End If
            Dim tg As String = String.Empty
            If Not Request.Params(ParamKeys.Tags) Is Nothing Then
                tg = Request.Params(ParamKeys.Tags)
                tg = HttpUtility.UrlDecode(tg)
                tg = Utilities.XSSFilter(tg)
                tg = Utilities.StripHTMLTag(tg)
                tg = Utilities.CheckSqlString(tg)
                tg = tg.Trim
            End If
            Dim au As Integer = 0
            If Not Request.Params("uid") Is Nothing Then
                If IsNumeric(Request.Params("uid")) Then
                    au = CInt(Request.Params("uid"))
                End If
            End If
            If Not SearchString = String.Empty Or Not tg = String.Empty Or au > 0 Then
                Dim mt As Integer = 0
                Dim sf As Integer = 0
                Dim ts As Integer = 0

                Dim an As String = ""

                If Not Request.Params("k") Is Nothing Then
                    If IsNumeric(Request.Params("k")) Then
                        mt = CInt(Request.Params("k"))
                        drpSearchType.SelectedIndex = drpSearchType.Items.IndexOf(drpSearchType.Items.FindByValue(mt.ToString))
                    End If

                End If
                If Not Request.Params("c") Is Nothing Then
                    If IsNumeric(Request.Params("c")) Then
                        sf = CInt(Request.Params("c"))
                        drpSearchColumns.SelectedIndex = drpSearchColumns.Items.IndexOf(drpSearchColumns.Items.FindByValue(sf.ToString))
                    End If
                End If
                If Not Request.Params("ts") Is Nothing Then
                    If IsNumeric(Request.Params("ts")) Then
                        ts = CInt(Request.Params("ts"))
                        drpSearchDays.SelectedIndex = drpSearchDays.Items.IndexOf(drpSearchDays.Items.FindByValue(ts.ToString))
                    End If

                End If
                If Not Request.Params("author") Is Nothing Then
                    If IsNumeric(Request.Params("author")) Then
                        au = CInt(Request.Params("author"))
                    Else
                        an = Request.Params("author")
                        an = Utilities.XSSFilter(an)
                        an = Utilities.StripHTMLTag(an)
                        an = Utilities.CheckSqlString(an)
                        an = an.Trim
                    End If
                    txtUserName.Text = Utilities.XSSFilter(an)
                End If

                Dim forums As String = String.Empty
                Dim tmpForumId As Integer = ForumId
                If Not Request.Params("f") Is Nothing Then
                    If IsNumeric(Request.Params("f")) Then
                        tmpForumId = CInt(Request.Params("f"))
                    Else
                        forums = Request.Params("f")
                        forums = Utilities.CheckSqlString(forums)
                    End If
                End If
                Dim ds As DataSet = Nothing
                Dim fc As New ForumController
                Dim sForumsAllowed As String = fc.GetForumsForUser(ForumUser.UserRoles, PortalId, ModuleId, "CanRead")
#If SKU = "ENTERPRISE" Then

                If MainSettings.FullText Then
                    If tg = String.Empty And Not SearchString = String.Empty Then
                        ds = DataProvider.Instance.Search_FullText(PortalId, ModuleId, UserId, tmpForumId, UserInfo.IsSuperUser, RowIndex, PageSize, SearchString, mt, sf, ts, au, an, forums, tg, sForumsAllowed)
                    ElseIf Not tg = String.Empty Then
                        ds = DataProvider.Instance.Search_Standard(PortalId, ModuleId, UserId, tmpForumId, UserInfo.IsSuperUser, RowIndex, PageSize, SearchString, mt, sf, ts, au, an, forums, tg, sForumsAllowed)
                    ElseIf Not SearchString = String.Empty Then
                        ds = DataProvider.Instance.Search_FullText(PortalId, ModuleId, UserId, tmpForumId, UserInfo.IsSuperUser, RowIndex, PageSize, SearchString, mt, sf, ts, au, an, forums, tg, sForumsAllowed)
                    ElseIf au > 0 And SearchString = String.Empty And tg = String.Empty Then
                        ds = DataProvider.Instance.Search_Standard(PortalId, ModuleId, UserId, tmpForumId, UserInfo.IsSuperUser, RowIndex, PageSize, SearchString, mt, sf, ts, au, an, forums, tg, sForumsAllowed)
                    End If

                Else
                    ds = DataProvider.Instance.Search_Standard(PortalId, ModuleId, UserId, tmpForumId, UserInfo.IsSuperUser, RowIndex, PageSize, SearchString, mt, sf, ts, au, an, forums, tg, sForumsAllowed)
                End If

#Else
                ds = DataProvider.Instance.Search_Standard(PortalId, ModuleId, UserId, tmpForumId, UserInfo.IsSuperUser, RowIndex, PageSize, SearchString, mt, sf, ts, au, an, forums, tg,sForumsAllowed)
#End If

                dtResults = ds.Tables(1)
                If dtResults.Rows.Count > 0 Then
                    RowCount = CInt(ds.Tables(0).Rows(0).Item(0))
                    pnlMessage.Visible = False
                    pnlResults.Visible = True
                    Try
                        rptPosts.DataSource = dtResults
                        rptPosts.DataBind()
                        BuildPager()
                    Catch ex As Exception
                        litMessage.Text = ex.Message.ToString
                        pnlMessage.Visible = True
                        pnlResults.Visible = False
                    End Try
                Else
                    litMessage.Text = GetSharedResource("[RESX:SearchNoResults]")
                    pnlMessage.Visible = True
                    pnlResults.Visible = False
                End If
            End If



        End Sub
        Private Sub BuildPager()
            Dim intPages As Integer
            intPages = CType(System.Math.Ceiling(RowCount / PageSize), Integer)
            Pager1.PageCount = intPages
            Pager1.CurrentPage = PageId
            Pager1.TabID = TabId
            Pager1.ForumID = ForumId
            Pager1.PageText = Utilities.GetSharedResource("[RESX:Page]")
            Pager1.OfText = Utilities.GetSharedResource("[RESX:PageOf]")
            Pager1.View = "search"
            'If UseAjax Then
            'Pager1.PageMode = Forums.Controls.PagerNav.Mode.CallBack
            'Else
            Pager1.PageMode = Modules.ActiveForums.Controls.PagerNav.Mode.Links
            'End If
            If Not Request.Params("q") Is Nothing Then
                Dim Params As String() = {"q=" & Request.Params("q")}
                Pager1.Params = Params
            End If
        End Sub
        Private Sub BindSearchRange()
            Dim sHours As String = GetSharedResource("SearchRangeHours.Text")
            Dim sDays As String = GetSharedResource("SearchRangeDays.Text")
            Dim sAll As String = GetSharedResource("SearchRangeAll.Text")
            drpSearchDays.Items.Clear()
            drpSearchDays.Items.Add(New ListItem(sAll, "0"))
            drpSearchDays.Items.Add(New ListItem(String.Format(sHours, "12"), "12"))
            drpSearchDays.Items.Add(New ListItem(String.Format(sHours, "24"), "24"))
            drpSearchDays.Items.Add(New ListItem(String.Format(sDays, "3"), "72"))
            drpSearchDays.Items.Add(New ListItem(String.Format(sDays, "5"), "124"))
            drpSearchDays.Items.Add(New ListItem(String.Format(sDays, "10"), "240"))
            drpSearchDays.Items.Add(New ListItem(String.Format(sDays, "15"), "360"))
            drpSearchDays.Items.Add(New ListItem(String.Format(sDays, "30"), "720"))
            drpSearchDays.Items.Add(New ListItem(String.Format(sDays, "45"), "1080"))
            drpSearchDays.Items.Add(New ListItem(String.Format(sDays, "60"), "1440"))
            drpSearchDays.Items.Add(New ListItem(String.Format(sDays, "90"), "2160"))
            drpSearchDays.Items.Add(New ListItem(String.Format(sDays, "120"), "2880"))
            drpSearchDays.Items.Add(New ListItem(String.Format(sDays, "240"), "5760"))
            drpSearchDays.Items.Add(New ListItem(String.Format(sDays, "365"), "8640"))


        End Sub
        Private Sub CheckNodes()
            Dim Forums() As String = Nothing
            Dim Forum As String = String.Empty
            If Not Request.Params("f") Is Nothing Then
                If Request.Params("f").Contains(":") Then
                    Forums = Request.Params("f").Split(CChar(":"))
                Else
                    Forum = Request.Params("f")
                End If
            End If
            If Not Forum = String.Empty Or Not Forums Is Nothing Or ForumId > 0 Then
                'Clear all Nodes
                ManageCheck(False)
                If Not Forums Is Nothing Then
                    For Each f As String In Forums
                        If Not f.Trim = "" Then
                            ManageCheck(False, "F:" & f)
                        End If
                    Next
                End If
                If Not Forum = String.Empty Then
                    ManageCheck(False, "F:" & Forum)
                End If
                If ForumId > 0 Then
                    ManageCheck(False, "F:" & ForumId.ToString)
                End If
            Else
                mnShowForums.Text = GetSharedResource("[RESX:SearchForumsAll]")
                ManageCheck(True)
            End If
            '            If ForumId = CInt(row("ForumId")) Or (Not Forums Is Nothing AndAlso Array.IndexOf(Forums, row("ForumId").ToString) > 0) Or Forum = row("ForumId").ToString Or (ForumId <= 0 And Forums Is Nothing And Forum = String.Empty) Then
        End Sub
        Private Sub ManageCheck(ByVal state As Boolean, Optional ByVal value As String = "")
            For Each node As TreeNode In trForums.Nodes
                If Not node.Checked Then
                    node.Checked = CBool(IIf(node.Value = value, True, state))
                End If
                If node.ChildNodes.Count > 0 Then
                    For Each cnode As TreeNode In node.ChildNodes
                        If Not cnode.Checked Then
                            cnode.Checked = CBool(IIf(cnode.Value = value, True, state))
                        End If
                        If cnode.ChildNodes.Count > 0 Then
                            For Each subnode As TreeNode In cnode.ChildNodes
                                If Not subnode.Checked Then
                                    subnode.Checked = CBool(IIf(subnode.Value = value, True, state))
                                End If

                            Next
                        End If
                    Next
                End If
            Next

        End Sub
        Private Function GetNodeCount() As Integer
            Dim nc As Integer = 0
            nc += trForums.Nodes.Count
            For Each node As TreeNode In trForums.Nodes
                nc += 1
                If node.ChildNodes.Count > 0 Then
                    nc += node.ChildNodes.Count
                    For Each cnode As TreeNode In node.ChildNodes
                        nc += cnode.ChildNodes.Count
                        If cnode.ChildNodes.Count > 0 Then
                            For Each subnode As TreeNode In cnode.ChildNodes
                                nc += cnode.ChildNodes.Count
                            Next
                        End If
                    Next
                End If
            Next
        End Function

        Private Sub BindForumsTree()

            Dim trNodes As New TreeNodeCollection
            Dim trGroupNode As TreeNode = Nothing
            Dim trParentNode As TreeNode = Nothing
            Dim trNode As TreeNode = Nothing
            Dim reader As IDataReader = Nothing
            Dim dt As New DataTable("Forums")
            Dim row As DataRow
            dt = New DataTable
            dt = DataProvider.Instance.UI_ForumView(PortalId, ModuleId, Me.UserId, UserInfo.IsSuperUser, ForumIds).Tables(0)


            Dim tmpGroup As String = String.Empty
            Dim i As Integer = 0
            For Each row In dt.Rows
                If tmpGroup <> row("ForumGroupId").ToString Then
                    trGroupNode = New TreeNode
                    trGroupNode.Text = row("GroupName").ToString
                    trGroupNode.ImageUrl = "~/DesktopModules/ActiveForums/images/tree/tree_group.png"
                    trGroupNode.ShowCheckBox = True
                    trGroupNode.Value = "G:" & row("ForumGroupId").ToString
                    trGroupNode.SelectAction = TreeNodeSelectAction.None
                    tmpGroup = row("ForumGroupId").ToString
                    trNodes.Add(trGroupNode)
                End If
                If CInt(row("ParentForumId")) = 0 Then
                    trNode = New TreeNode
                    trNode.Text = row("ForumName").ToString
                    trNode.ImageUrl = "~/DesktopModules/ActiveForums/images/tree/tree_forum.png"
                    trNode.ShowCheckBox = True
                    trNode.SelectAction = TreeNodeSelectAction.None
                    trNode.Value = "F:" & row("ForumId").ToString
                    If HasSubForums(CInt(row("ForumId")), dt) Then
                        AddChildNodes(trNode, dt, row)
                    End If
                    If trNode.ChildNodes.Count > 0 Or Permissions.HasPerm(row("CanRead").ToString, ForumUser.UserRoles) Then
                        trGroupNode.ChildNodes.Add(trNode)
                    End If

                End If

            Next
            Dim tr As TreeNode
            For Each tr In trNodes
                If tr.ChildNodes.Count > 0 Then
                    trForums.Nodes.Add(tr)
                End If
            Next


        End Sub
        Private Sub AddChildNodes(ByVal ParentNode As TreeNode, ByVal dt As DataTable, ByVal dr As DataRow)
            Dim tNode As TreeNode = Nothing
            Dim row As DataRow = Nothing
            For Each row In dt.Rows
                If CInt(dr("ForumId")) = CInt(row("ParentForumId")) Then
                    tNode = New TreeNode
                    tNode.Text = row("ForumName").ToString
                    tNode.ImageUrl = "~/DesktopModules/ActiveForums/images/tree/tree_forum.png"
                    tNode.ShowCheckBox = True
                    tNode.Value = "F:" & row("ForumId").ToString
                    tNode.Checked = False
                    tNode.SelectAction = TreeNodeSelectAction.None
                    If Permissions.HasPerm(row("CanRead").ToString, ForumUser.UserRoles) Then
                        ParentNode.ChildNodes.Add(tNode)
                    End If
                    AddChildNodes(tNode, dt, row)
                End If
            Next
        End Sub
        Private Function HasSubForums(ByVal ForumId As Integer, ByVal dt As DataTable) As Boolean
            Dim row As DataRow = Nothing
            For Each row In dt.Rows
                If CInt(row("ParentForumId")) = ForumId And Permissions.HasPerm(row("CanRead").ToString, ForumUser.UserRoles) Then
                    Return True
                End If
            Next
            Return False
        End Function

#End Region
#Region "Public Methods"
        Public Function GetIcon(ByVal Icon As String, Optional ByVal Pinned As Boolean = False, Optional ByVal Locked As Boolean = False) As String
            Dim IsRead As Boolean = True
            Dim myTheme As String = MainSettings.Theme
            If Icon = String.Empty Then

                If Pinned = True Then
                    Return "~/DesktopModules/ActiveForums/themes/" & myTheme & "/emoticons/pinned.gif"
                ElseIf Locked = True Then
                    Return "~/DesktopModules/ActiveForums/themes/" & myTheme & "/emoticons/lock.gif"
                Else
                    If IsRead = True Then
                        Return "~/DesktopModules/ActiveForums/themes/" & myTheme & "/emoticons/document.gif"
                    Else
                        Return "~/DesktopModules/ActiveForums/themes/" & myTheme & "/emoticons/document_new.gif"
                    End If

                End If
            Else
                Return "~/DesktopModules/ActiveForums/themes/" & myTheme & "/emoticons/" & Icon
            End If
        End Function
        Public Function GetLastPost(ByVal UserID As Integer, ByVal UserName As String, ByVal DateAdded As DateTime, ByVal LastPostID As Integer, Optional ByVal ParentPostID As Integer = 0, Optional ByVal Subject As String = "", Optional ByVal ForumID As Integer = 0, Optional ByVal ReplyCount As Integer = 1, Optional ByVal FirstName As String = "", Optional ByVal LastName As String = "", Optional ByVal DisplayName As String = "") As String
            Try
                Dim PostId As Integer = LastPostID
                Dim sb As New Text.StringBuilder
                If Not UserName = "" Then
                    sb.Append("<nobr> " & GetSharedResource("By.Text") & " ")
                    If UserID = 0 Or UserID = -1 Then
                        sb.Append(UserName)
                    Else
                        Dim isMod As Boolean = False
                        If CurrentUserType = CurrentUserTypes.Admin Or CurrentUserType = CurrentUserTypes.ForumMod Or CurrentUserType = CurrentUserTypes.SuperUser Then
                            isMod = True
                        End If
                        sb.Append(UserProfiles.GetDisplayName(ModuleId, MainSettings.ProfileVisibility, isMod, UserID, MainSettings.UserNameDisplay, UserName, FirstName, LastName, DisplayName))
                    End If
                    sb.Append("</nobr><br />")
                End If

                sb.Append("<nobr>" & GetDate(DateAdded) & "</nobr><br />")
                Return sb.ToString
            Catch ex As Exception
                Return "&nbsp;"
            End Try

        End Function
        Public Function GetTopic(ByVal ForumID As Integer, ByVal TopicId As Integer, ByVal ContentId As Integer, ByVal Body As String, ByVal DateUpdated As Date, ByVal Subject As String, ByVal UserID As Integer, ByVal Replies As Integer, ByVal ForumName As String, ByVal UserName As String, Optional ByVal FirstName As String = "", Optional ByVal LastName As String = "", Optional ByVal PostType As String = "", Optional ByVal DisplayName As String = "") As String
            Dim sPollImage As String = ""
            If PostType = "POLL" Then
                sPollImage = "<img src=""" & Page.ResolveUrl("~/DesktopModules/ActiveForums/themes/" & MainSettings.Theme & "/poll.gif") & """ align=absmiddle border=0 />"
            End If
            Dim sOut As String
            Dim Params As String() = {ParamKeys.ForumId & "=" & ForumID, ParamKeys.ViewType & "=" & Views.Topic, ParamKeys.TopicId & "=" & TopicId, ParamKeys.ContentJumpId & "=" & ContentId}
            If MainSettings.UseShortUrls Then
                Params = New String() {ParamKeys.TopicId & "=" & TopicId, ParamKeys.ContentJumpId & "=" & ContentId}
            End If
            sOut = "<a href=""" & NavigateUrl(TabId, "", Params) & """>" & sPollImage & Subject & "</a><br />"
            Body = Utilities.StripHTMLTag(Body)
            Body = Body.Replace(vbCrLf, " ")
            If Body.Length > 250 Then
                Body = Body.Substring(0, 249) & " ..."
            End If
            sOut &= "<span style=""font-size:90%;"">" & Body & "</span><br />"
            sOut &= "<span class=""afsmalltext"">" & GetSharedResource("By.Text") & " " & GetDisplayName(UserName, UserID, FirstName, LastName, DisplayName) & " " & GetSharedResource("IN.Text") & " <a href=""" & NavigateUrl(TabId, "", New String() {ParamKeys.ViewType & "=" & Views.Topics, ParamKeys.ForumId & "=" & ForumID}) & """>" & ForumName & "</a>"
            sOut &= " " & GetSharedResource("On.Text") & " " & GetDate(DateUpdated) & "</span>"
            Return sOut
        End Function
        Public Function GetDisplayName(ByVal Username As String, ByVal UserID As Integer, Optional ByVal FirstName As String = "", Optional ByVal LastName As String = "", Optional ByVal DisplayName As String = "") As String
            Return UserProfiles.GetDisplayName(ModuleId, MainSettings.ProfileVisibility, False, UserID, MainSettings.UserNameDisplay, Username, FirstName, LastName, DisplayName)
        End Function
        Public Function GetRowCSS(ByVal IsRead As Boolean) As String
            If IsRead = True Then
                Return "aftopicrow"
            Else
                Return "aftopicrownew"
            End If
        End Function
        Public Function GetRowAltCSS(ByVal IsRead As Boolean) As String
            If IsRead = True Then
                Return "aftopicrowalt"
            Else
                Return "aftopicrownewalt"
            End If
        End Function

#End Region


    End Class
End Namespace
